<%@tag pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@attribute name="item" required="true" type="cn.livingCloud.dto.UserAccountDto" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

<td>${item.userDto.name}</td>
<td>${item.username}</td>
<td>
    <c:if test="${not item.enable}">
        <span class="label label-danger">禁用</span>
    </c:if>
    <c:if test="${item.enable}">
        <span class="label label-success">启用</span>
    </c:if>
</td>
<td>
    <button type="button" class="btn btn-info btn-xs" data-container="body" data-toggle="popover"
            data-placement="right"
            data-content="
            <c:forEach items="${item.privilegeList}" var="privilege" varStatus="status">
     <span class='label label-primary' style='margin-bottom:2px;display: inline-block;'>  ${privilege.label}</span>
        </c:forEach>
        ">
        <span class="fa fa-info-circle"></span>
    </button>
</td>
<td>
    <c:if test=" ${ not item.last_login_time}">
        暂未登陆
    </c:if>
    ${item.last_login_time}
</td>
<td>
    <c:if test="${not item.enable}">
        <form class="form-inline" action="${contextPath}/admin/user/delete.htm" method="post">
            <button type="button" class="btn btn-success ChangeState"
                    uuid="${item.uuid}" state="true">启用
            </button>

            <a class="btn btn-primary"
               href="${contextPath}/admin/user/load.htm?userId=${item.userId}&uuid=${item.uuid}">变更权限</a>
            <a class="btn btn-warning"
               href="${contextPath}/admin/user_account/change_password_from.htm?uuid=${item.uuid}">更改密码</a>
            <input type="hidden" name="uuid" value="${item.uuid}">
            <button class="btn btn-danger" type="submit"
                    onclick="javascript:return confirm('确定删除账号[${item.username}]?');">
                删除
            </button>
        </form>
    </c:if>
    <c:if test="${item.enable}">
        <button type="button" class="btn btn-warning ChangeState"
                uuid="${item.uuid}" state="false">禁用
        </button>
        <a class="btn btn-primary"
           href="${contextPath}/admin/user/load.htm?userId=${item.userId}&uuid=${item.uuid}">变更权限</a>
        <a class="btn btn-warning"
           href="${contextPath}/admin/user_account/change_password_from.htm?user_id=${item.userId}&uuid=${item.uuid}">更改密码</a>
    </c:if>

</td>
